package com.finley.flowabledemo.plc.service;

import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
import org.springframework.stereotype.Service;

@Service
public class S7SerializerService {

    private final S7Serializer s7Serializer;

    public S7SerializerService(S7PLC s7PLC) {
        this.s7Serializer = S7Serializer.newInstance(s7PLC);
    }

    public <T> T read(Class<T> clazz) {
        return s7Serializer.read(clazz);
    }

    public <T> void write(T object) {
        s7Serializer.write(object);
    }
}